<!DOCTYPE html>
<html>
<head>
    <title>我的游记</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <script src="/js/plugins/jrender/jrender.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/userTravels.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog/dialog.css"/>
    <script src="/js/plugins/dialog/dialog.min.js"></script>

</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="profiles.html">
                <span><i class="fa fa-chevron-left"></i></span>
            </a>
        </div>
        <div class="col">
            <span>兑换历史记录</span>
        </div>
        <div class="col"></div>
    </div>
</div>

<div class="container orders">
    <dl class="list" render-loop="list">
        <dd>
            <a href="#">
                <img render-src="list.goodsCoverUrl">
                <h6 class="title" render-html="list.goodsName"></h6>
                <p style="color: red">消耗积分: <span render-html="list.totalIntegral"></span>
                    <!-- <span class="span-right">
                         <a render-key="list.id" render-fun="handle">删除订单</a>
                     </span>-->
                </p>
            </a>
        </dd>
    </dl>
</div>
<script>
    $(function () {
        // 本地缓存对象
        var user = JSON.parse(sessionStorage.getItem("user"));
        // 查询我的订单
        $.get("/orders/" + user.id, {state: 2}, function (data) {
            console.log(data);
            $(".orders").renderValues({list: data}, {
                handle: function (ele, value) {
                    console.log(ele);
                    $(ele).attr("id", value);
                }
            });
        });
        // 给删除订单绑定点击事件
        $(document).on('click', '#deleteBtn', function () {
            $(document).dialog({
                type: 'confirm',
                closeBtnShow: true,
                content: '确定要删除此订单吗?',
            });
        });
    })
</script>
</body>
</html>
